package com.perfma.xtest.tool.word;

import com.google.common.collect.Maps;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author: junhui.si
 * @date: 2021-07-22 18:03
 **/
public class ObjectEqualDemo {

    public static void main(String[] args) {
        ClientDTO o1 = ClientDTO.builder().appId(1L).clientId("wqe").clientType(ClientType.JavaAgent).diskSize(1232L).extensions(Maps.newHashMap()).build();
        ClientDTO o2 = ClientDTO.builder().appId(1L).clientId("wqe").clientType(ClientType.JavaAgent).diskSize(1232L).extensions(Maps.newHashMap()).build();
//        System.out.println(Objects.equals(o1,o2));
//        System.out.println(Objects.hashCode(o1));
//        System.out.println(Objects.hashCode(o2));
//        System.out.println(Long.MAX_VALUE);

        String s = "11_%";
        s = escapeStr(s);
        System.out.println(s);
        System.out.println("1%11_%".contains(s));
    }

    public static String escapeStr(String str) {
        if (StringUtils.isEmpty(str)) {
            str = str.replaceAll("\\\\", "\\\\\\\\");
            str = str.replaceAll("_", "\\\\_");
            str = str.replaceAll("%", "\\\\%");
        }
        return str;
    }
}
